﻿using AMAP.Domain;
using AMAP.ServiceClasses.Common;
using AMAP.ServiceInterfaces;
using AMAP.ServiceInterfaces.Common;
using System.Collections.Generic;
using System.Linq;

namespace AMAP.ServiceClasses
{
    public class ExternalCompositionService : BaseRepositoryService<ExternalComposition>, IExternalCompositionService
    {
        public ExternalCompositionService(IDatabaseFactory databaseFactory)
            : base(databaseFactory)
        {
        }

        public ExternalComposition GetByExternalOrderId(int ExternalOrderId)
        {
            return this.dataContext.ExternalCompositionSet.FirstOrDefault(e => e.ExternalOrderId == ExternalOrderId);
        }

        public IList<ExternalComposition> GetListByBasketId(int BasketId)
        {
            return this.dataContext.ExternalCompositionSet.Where(e => e.BasketId == BasketId).ToList<ExternalComposition>();
        }
    }
}
